package base;

import java.util.Scanner;

public class InputField {

	//Get the input and create a PlayField
	public static PlayField populateField()
	{
		
		Scanner in = new Scanner(System.in);
		
		//BufferedReader inn = new BufferedReader(new FileReader("D:\\Projects\\Eclipse Projects\\Trolling\\tests"));
		
		int moves = Integer.parseInt(in.nextLine());
		
		int size = Integer.parseInt(in.nextLine());
		
		Tower[][] towers = new Tower[size][size];
		
		//Hold the values in a line
		String[] inputRocksInALine;
		
		//Read a line create the towers for all lines
		//TODO assessment of the field to be added
		for(int i=0; i < size; ++i)
		{
			String inputLine = in.nextLine();
			
			inputRocksInALine = inputLine.split(" ");
			
			//Create Towers
			for(int j = 0; j < size; ++j)
			{
				towers[i][j] = new Tower(i, j, Integer.parseInt(inputRocksInALine[j]));
			}
		}
		
		in.close();
		
		return new PlayField(size, moves, towers);
		
	}
}
